package com.wnxy.controller;


import com.wnxy.dto.ManagerRoleDto;
import com.wnxy.dto.PageRoleDto;
import com.wnxy.dto.Result;
import com.wnxy.model.Manager;
import com.wnxy.service.ManagerRoleService;
import com.wnxy.vo.EmPowerVo;
import com.wnxy.vo.RoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author alice
 * @since 2021-11-12
 */
@RestController
@RequestMapping("/managerRole")
public class ManagerRoleController {
    @Autowired
    private ManagerRoleService managerRoleService;
    @PostMapping("/find")
    public Result findRole(@RequestBody RoleVo roleVo) {
        PageRoleDto role = managerRoleService.findRole(roleVo);
        return Result.getInstance().setFlag(true)
                .setStatusCode(200)
                .setData(role);
    }
    @PostMapping("/empower")
    public Result empower(@RequestBody EmPowerVo emPowerVo) {
        managerRoleService.empower(emPowerVo);
        return Result.getInstance().setFlag(true)
                .setStatusCode(200)
                .setMessage("授权成功")
                .setData(null);
    }
    @GetMapping("/lodeManagerRole")
    public Result lodeManagerRole() {
        return Result.getInstance().setFlag(true)
                .setStatusCode(200)
                .setMessage("查询成功")
                .setData(managerRoleService.lodeManagerRole());
    }


}

